{{ template:keywords value = model:keywords }}
{{ template:description value = model:description }}

<div class="news-detail">
	<h3 class="title">{{ model:title }}</h3>
	<div class="description">
	{{model:description}}
	</div>
	<div class="detail">
	{{model:bodyhtml}}
	</div>
	
	{{if config:comment}}
	<div class="clr"></div>
	<h3 class="title">{{helper:lang line='news:comment'}}</h3>
	<ul class="list-comment">
	{{comment_data}}
		<li>
			<span class="av fl">
			<img src="{{users:avatar file = avatar}}" />
			</span>
			<strong class="fl"><a class="display_name" href="{{url:site uri='emp_profile/info/{{user_id}}'}}">{{display_name}}</a></strong> <small>{{helper:lang line='news:comment:vaoluc'}} {{helper:date format='d-m-Y H:i' timestamp = created}} </small>
			<br /><p class="fl">{{content}}</p>
		</li>
	{{/comment_data}}
	</ul>
	<div class="errors">  </div>
    <form id="comment" action="{{ url:site uri='comment/insert' }}">
	<input type="hidden" value="{{model:id}}" name="pid" />
	<input type="hidden" value="{{user:id}}" name="user_id" />
	<input type="hidden" value="{{module:current}}" name="module" />
	<div>
	<input type="hidden" value="{{user:display_name}}" readonly name="full_name" />
	</div>
	<div>
	<textarea placeholder="{{helper:lang line='global:content'}}" name="content" class="medium" style="width:300px;"></textarea>
	</div>
	<div><input type="submit" class="btn" value="{{helper:lang line = 'global:send'}}" /></div>
	</form>
	<script type="text/javascript">
		var comment;
		$('#comment .btn').click(function(){
		if(comment!=null)
			comment.abort();
		comment = $.ajax({
			url:$('#comment').attr('action'),
			data:$('#comment').serialize(),
			type:'post',
			dataType:'json',
			success: function(data){
				if(data.error)
					$('div.errors').addClass('alert').html('').append(data.error);
				else
					location.reload();
				}
		});
		return false;
	});
	</script>
	<script type="text/javascript">
	var profile;
	$('.display_name').click(function(){
		$url = $(this).attr('href');
		if(profile != null)
			profile.abort();
		profile = $.ajax({
			url:$url,
			type:'get',
			success: function(data){
				$('#ajax_info').html(data);
			}
		});
		return false;
	});
	</script>
<div id="ajax_info"></div>	
{{endif}}
</div>